<extend name="Public:base" />
<block name="header_js">
<script type="text/javascript" src="__DATA__/editor/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__DATA__/editor/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function(){
    var ue = UE.getEditor('inputContent3',{
        serverUrl :"{:U('Public/editorMethod')}"
    });
    UE.getEditor('inputEnContent3',{
        serverUrl :"{:U('Public/editorMethod')}"
    });
})
</script>

<script type="text/javascript" src="__PUBLIC__/js/calendar.config.js"></script>
<script type="text/javascript" src="__DATA__/static/jq_plugins/iColorPicker/iColorPicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/XYHUploader/XYHUploader.js"></script>

<script type="text/javascript">
$(function () {
	//缩略图上传
	$('#litpic').XYHUploader({
		sfile:"img1", 
		furl:"{:U('Public/upload',array('img_flag' => 1))}", 
		burl:"{:U('Public/browseFile', array('stype' => 'picture'))}",
		thide: false,
		thumflag: false
	});	
	
});


function select_type(id) {
	$("#content_1").hide();
	$("#content_2").hide();
	$("#content_3").hide();
	//
    $("#en_content_1").hide();
    $("#en_content_3").hide();
	//
	$("#content_"+id).show();
	//
	if(id == 2){
	    $('.LanTab').hide();
	}else{
	    $('.LanTab').show();
	}
}
$(function(){
	$("#content_1").show();
	$('#inputBlocktype').change(function(event) {
		var type = $(this).val();
		select_type(type);
	});
	//
	$('.en_content_tab').click(function () {
        var type = $('#inputBlocktype').val();
        $("#content_"+type).hide();
        $("#en_content_"+type).show();
    });
    $('.cn_content_tab').click(function () {
        var type = $('#inputBlocktype').val();
        $("#en_content_"+type).hide();
        $("#content_"+type).show();
    });
});


</script>
	
</block>

<block name="content">
	<div class="row">
		<div class="col-lg-12">
			<h3 class="page-header"><em class="glyphicon glyphicon-cloud-upload"></em> 
			{$type}  
		    </h3>
		</div>
		
	</div>


	<div class="row">
		<div class="col-lg-12">

				<form method='post' class="form-horizontal" id="form_do" name="form_do" action="{:U('add')}">											

					<div class="form-group">
						<label for="inputName" class="col-sm-2 control-label">名称</label>
						<div class="col-sm-9">
							<input type="text" name="name" id="inputName" class="form-control" placeholder="名称" required="required" />									
						</div>
					</div>
					<div class="form-group">
						<label for="inputBlocktype" class="col-sm-2 control-label">类型</label>
						<div class="col-sm-9">
							<select name="block_type" id="inputBlocktype" class="form-control">
								<foreach name='blocktypelist' item='v'>
								<option value="{$key}">{$v}</option>
								</foreach>
							</select>								
						</div>
					</div>

					<div class="form-group LanTab">
						<label for="inputContent" class="col-sm-2 control-label"><!--内容--></label>
						<div class="col-sm-9">
							<p><span class="cn_content_tab naction">中文</span> | <span class="en_content_tab">英文</span></p>
						</div>
					</div>

					<div class="form-group" id="content_1" style="display:none;">
						<label for="inputContent" class="col-sm-2 control-label">内容</label>
						<div class="col-sm-9">
							<textarea name="content[1]" id="inputContent"  class="form-control" rows="2"></textarea>						
						</div>
					</div>
					<div class="form-group" id="en_content_1" style="display:none;">
						<label for="inputEnContent" class="col-sm-2 control-label">英文内容</label>
						<div class="col-sm-9">
							<textarea name="en_content[1]" id="inputEnContent"  class="form-control" rows="2"></textarea>
						</div>
					</div>


					<div class="form-group" id="content_2" style="display:none;">
						<label for="litpic" class="col-sm-2 control-label">内容</label>
						<div class="col-sm-9">
							    <input type="text" class="form-control" name="content[2]" id="litpic"  value="" placeholder="缩略图地址" />	
						</div>	
					</div>

					<div class="form-group" id="content_3" style="display:none;">
						<label for="inputContent" class="col-sm-2 control-label">内容</label>
						<div class="col-sm-9">
							<textarea name="content[3]" id="inputContent3" style="height: 370px;"></textarea>						
						</div>
					</div>
					<div class="form-group" id="en_content_3" style="display:none;">
						<label for="inputEnContent" class="col-sm-2 control-label">英文内容</label>
						<div class="col-sm-9">
							<textarea name="en_content[3]" id="inputEnContent3" style="height: 370px;"></textarea>
						</div>
					</div>

					<div class="form-group">
						<label for="inputRemark" class="col-sm-2 control-label">自由块说明</label>
						<div class="col-sm-9">
							<textarea name="remark" id="inputRemark" class="form-control"></textarea>						
						</div>
					</div>	
					
					<div class="row margin-botton-large">
						<div class="col-sm-offset-2 col-sm-9">
							<div class="btn-group">
								<button type="submit" class="btn btn-primary"> <i class="glyphicon glyphicon-saved"></i>
									保存
								</button>
								<button type="button" onclick="goUrl('{:U('index')}')" class="btn btn-default"> <i class="glyphicon glyphicon-chevron-left"></i>
									返回
								</button>
							</div>
						</div>
					</div>
				</form>
	
		</div>
	</div>


</block>